home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / FUTILS / FILE1.DOC < prev    next >
Text File  |  1989-02-22  |  3KB  |  87 lines

  1.                              /\ RKCP /\
  2.                              \/ RKCP \/
  3.  
  4. *******************************************************************
  5. ************************ FILE1 by Rex Kerr ************************
  6. ************************ Copyright (C) 1989 ***********************
  7. *******************************************************************
  8.  
  9. FILE1 is a TP5 unit that performs various operations on files.
  10.  
  11.    I wrote it after I had just written a "copyfile" procedure from
  12. scratch for the fifth time for use in one of my many file-using
  13. programs.  Then I realized that I didn't have to keep writing it
  14. over and over and over again.  I wrote just one and put it in a unit.
  15. But I was also writing a function called "existfile" over and over.
  16. So I added that as well.
  17.  
  18.    So I wrote the unit.  But that wasn't enough to make up a unit all
  19. by itself.  So I added three more procedures:  RenameFile, EraseFile
  20. and TypeFile.  Here they are:
  21.  
  22. ***
  23.  
  24. ExistFile(st : pathstr) : boolean;
  25.  
  26. This returns true if the file in st exists; otherwise it returns
  27. false.
  28.  
  29. ***
  30.  
  31. CopyFile(fromfile,tofile : pathstr; var result : byte);
  32.  
  33. This copies the file specified in fromfile to the one specified
  34. in tofile.  The result bytes returns 0 if the operation was
  35. succesful.  If not, it will return one of these error codes:
  36.     1 :  File to copy from does not exist as specified
  37.     2 :  File to copy to already exists as specifed  (FILE1 won't
  38.          overwrite existing files.)
  39.     3 :  Heap too small to create file copy buffer  (FILE1 needs
  40.          at least 1k of heap, and will use up to 32k, if it is
  41.          available.)
  42.  
  43. ***
  44.  
  45. RenameFile(fromfile,tofile : pathstr; var result : byte);
  46.  
  47. This renames the file in fromfile to the name in tofile.  The result
  48. byte returns 0 if it is successful.  Otherwise, it returns one of
  49. the non-zero error codes shown below:
  50.      1 :  File to rename does not exist
  51.      2 :  Name to rename to already exists
  52.  
  53. ***
  54.  
  55. EraseFile(delfile : pathstr; var result : byte);
  56.  
  57. EraseFile erases the file named in delfile.  The result byte returns
  58. 0 if it is succesful.  If not, it returns one of the below error
  59. codes:
  60.      1 :  File does not exist to erase
  61.  
  62. ***
  63.  
  64. TypeFile(showfile : pathstr; var result : byte);
  65.  
  66. This types the file named in showfile to the current TP5 window on
  67. the screen.  While it is typing the file out, if any key is pressed,
  68. it will stop and wait until another key is pressed.  When it is,
  69. the writing to the screen will continue.  If ESC is pressed at any
  70. time during the type, the procedure will end.  If typing is
  71. succesfully started, the result byte will contain 0.  Otherwise, it
  72. will contain one of the error codes shown below:
  73.      1 :  File to type does not exist
  74.      2 :  Heap too small  (TypeFile also needs at least 1k of heap,
  75.           it will use up to 32k if that much is available.)
  76.  
  77. ***
  78.  
  79.   That's everything.  I don't think I need to give any further
  80. explination of them, but if you think I've left something out,
  81. or if anything is unclear, please contact me on either EasyPlex
  82. or the TP5 messages section of BPROGA (both on CompuServe).
  83.  
  84. Rex Kerr  71550,3147
  85.  
  86.                              /\ RKCP /\
  87.                              \/ RKCP \/